<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/commond/taglibs.jsp"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="./jqueryui/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="./js/common/ZeroClipboard.js"></script>
<script type="text/javascript">
$(function(){
	alert(window.locaiont.href);
	var clip = new ZeroClipboard( document.getElementById("d_clip_button"), {
		moviePath: $("#ctxVal").val()+"/js/common/ZeroClipboard.swf"
	} );
	
	clip.on( 'load', function(client) {
// 	   alert( "movie is loaded" );
	} );
	
	clip.on( 'complete', function(client, args) {
		this.style.display = 'none'; // "this" is the element that was clicked
		alert("Copied text to clipboard: " + args.text );
	} );
	
	clip.on( 'mouseover', function(client) {
// 	   alert("mouse over");
	} );
	
	clip.on( 'mouseout', function(client) {
// 	   alert("mouse out");
	} );
	
	clip.on( 'mousedown', function(client) {
	
// 	   alert("mouse down");
	} );
	
	clip.on( 'mouseup', function(client) {
// 	   alert("mouse up");
	} );
});
function addnewline(){
	var html="";
	html+="<tr>";
	html+="<td>";
	html+="key";
	html+="<input class='key'>";
	html+="</td>";
	html+="<td>";
	html+="value";
	html+="<input class='value'>";
	html+="</td>";
	html+="</tr>";
	$("#testtable").append(html);
}
function delline(){
	$("#testtable tr:last").remove();
}
function sendrequest(){
	var content="";
	$("#testtable tr").each(function(i){
		var firsttd=$(this).find("td:first");
		var keytxt=firsttd.find("input").val();
		if(keytxt.length<=0)
			return true;
		var nexttd=firsttd.next();
		var valuetxt=nexttd.find("input").val();
		if(valuetxt.length<=0)
			return true;
		if(i>0){
			content+="&";
		}else{
			content+="?";
		}
		content+=keytxt+"="+valuetxt;
	});
	window.open($("#urlinput").val()+content);
}

function getData(){
	var contentArea="";
	contentArea=$.trim($('#content').val());
	if(contentArea.length>0&&cliptype==1){
		contentArea=contentArea.replace(/\n/g,"<br>");
		contentArea=contentArea.replace(/\r.\n/g,"<br>");
		contentArea=contentArea.replace(/<(\/?br[^>]*)>/g, "[--$1--]");
		contentArea=htmlData(contentArea);
		contentArea=contentArea.replace(/\[--([^-]+)--\]/g, "<$1>");
	}
	alert(contentArea);
}

var browser={    
	versions:function(){            
	var u = navigator.userAgent, app = navigator.appVersion;            
		return {                
			trident: u.indexOf('Trident') > -1, //IE内核                
			presto: u.indexOf('Presto') > -1, //opera内核                
			webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核                
			gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核                
			mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端                
			ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端                
			android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器                
			iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器                
			iPad: u.indexOf('iPad') > -1, //是否iPad                
			webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部            
		};
	}()
} 

document.writeln(" <br>是否为移动终端: "+browser.versions.mobile);
document.writeln(" <br>ios终端: "+browser.versions.ios);
document.writeln(" <br>android终端: "+browser.versions.android);
document.writeln(" <br>是否为iPhone: "+browser.versions.iPhone);
document.writeln(" <br>是否iPad: "+browser.versions.iPad);
document.writeln(navigator.userAgent); 

</script>
<body>
<input type="hidden" value="${ctx }" id="ctxVal">
	<input id="urlinput" style="width: 500px;">
	<button onclick="addnewline();">addline</button>
	<button onclick="delline();">delline</button>
	<button onclick="sendrequest();">sendrequest</button>
	<button id="d_clip_button" class="my_clip_button" title="Click me to copy to clipboard." data-clipboard-target="fe_text" data-clipboard-text="Default clipboard text from attribute"><b>Copy To Clipboard...</b></button>
	<table width="800" id="testtable">
	</table>
	<div style="width: 500px;">
		<textarea id="fe_text" cols="50" rows="3">Copy me!</textarea>
		<textarea id="content">
			
		</textarea>
		<button onclick="getData()">getdata</button>
	</div>
</body>
</html>